﻿@using SESM.DAL
@using SESM.Tools.Helpers
@model SESM.Models.Views.Map.MapViewModel
@{
    ViewBag.Title = "Map List";
    List<SelectListItem> listDir = (List<SelectListItem>) ViewData["listDir"];
    int id = (int)ViewData["ID"];
    AccessLevel accessLevel = (AccessLevel)ViewData["AccessLevel"];
}
<div class="row">
    <div class="col-md-6">
        @using (Html.BeginForm("Index", "Map", null, FormMethod.Post, new {@class = "form-horizontal well", role = "form"}))
        {

            @Html.ValidationSummary()
            <div class="form-group">
                <div class="col-md-12">
                    @Html.DropDownListFor(m => m.MapName, listDir, new {@class = "form-control center-block", size = "10", style = "max-width:none;width:94%"})
                    @Html.ValidationMessageFor(m => m.MapName)
                </div>
            </div>

            <div style="text-align: center;">

                <div class="btn-group">
                    @if ((ServiceState)ViewData["ServerState"] == ServiceState.Stopped)
                    {
                        <input type="submit" value="Select" name="action:SaveMap" class="btn btn-primary" />
                    }
                    <input type="submit" onclick=" return confirm('This will restart this server. Are you sure you want to do this ?'); " value="Select And (Re)Start" name="action:SaveRestartMap" class="btn btn-success" />
                </div><br/>
                <div class="btn-group">
                    <input type="submit" value="Download" name="action:DownloadMap" class="btn btn-success" />
                    <input type="submit" onclick=" return confirm('This will delete this map. Are you sure you want to do this ?'); " value="Delete" name="action:DeleteMap" class="btn btn-danger" />
                    <input type="submit" value="Rename" name="action:RenameMap" class="btn btn-warning" />
                    
                </div><br />
                <div class="btn-group">
                    <a class="btn btn-info" href="@(Url.Action("Upload", "Map", new {id = id}))">Upload</a>
                    <a class="btn btn-primary" href="@(Url.Action("New", "Map", new {id = id}))">Create</a>
                </div>
            </div>
        }
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <a class="btn btn-default" href="@(Url.Action("Status", "Server", new {id = id}))">
            <span class="glyphicon glyphicon-chevron-left"></span> Back to Server Status
        </a>
    </div>
</div>
